//1.导入模块
//2.注册模块
//3.使用h()函数的第二个参数传入模块需要的数据(对象)
import { init } from "snabbdom/build/package/init"
import { h } from "snabbdom/build/package/h"

import { styleModule } from "snabbdom/build/package/modules/style"
import { eventListenersModule } from "snabbdom/build/package/modules/eventlisteners"

console.log('style=',styleModule,eventListenersModule, );
let patch = init([
    styleModule,
    eventListenersModule
])

let vnode = h('div',{
    style:{
        backgroundColor:'red'
    },
    on:{
        click:eventHandler
    }
},[
    h('h1','Hello Snabbdom'),
    h('p','这是P标签'),
    '12323--这是直接的内容--1234'
])

function eventHandler(){
    console.log('我被点击了');
}

let app = document.querySelector("#app");
patch(app, vnode);